package top.xiaoshuaila.moments.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import top.xiaoshuaila.moments.pojo.RespBean;
import top.xiaoshuaila.moments.pojo.Users;
import top.xiaoshuaila.moments.service.FindService;
import top.xiaoshuaila.moments.utils.Usersutils;

@Controller
@RequestMapping("find")
@Api(tags = "朋友圈与广场接口")
public class FindController {
    @Autowired
    private FindService findService;
    @GetMapping("getfindfynamic")
    @ResponseBody
    @ApiOperation("获取朋友圈动态")
    public RespBean getfindfynamic(int page){
        Users users= Usersutils.getuser();
        return RespBean.success("success",findService.getfindfynamic(users.getId(),page));
    }
    @GetMapping("getsquarefynamic")
    @ResponseBody
    @ApiOperation("获取广场动态")
    public RespBean getsquarefynamic(int page){
        Users users= Usersutils.getuser();
        return RespBean.success("success",findService.getsquarefynamic(users.getId(),page));
    }
    @GetMapping("gettotal")
    @ResponseBody
    @ApiOperation("获取朋友圈动态数目")
    public RespBean gettotal(){
        Users users= Usersutils.getuser();
        return RespBean.success("success",findService.gettotal(Usersutils.getuser().getId()));
    }
    @GetMapping("gettotalsquare")
    @ResponseBody
    @ApiOperation("获取广场动态数目")
    public RespBean gettotalsquare(){
        Users users= Usersutils.getuser();
        return RespBean.success("success",findService.gettotalsquare(Usersutils.getuser().getId()));
    }
}
